home *** CD-ROM | disk | FTP | other *** search
- package test.ui;
-
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Font;
- import java.awt.Frame;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Insets;
- import java.awt.Label;
- import java.awt.List;
- import java.awt.Panel;
- import java.awt.SystemColor;
- import java.awt.TextField;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ItemEvent;
- import java.awt.event.ItemListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.awt.event.TextEvent;
- import java.awt.event.TextListener;
- import java.awt.event.WindowEvent;
- import java.awt.event.WindowListener;
- import java.lang.reflect.Constructor;
- import java.lang.reflect.Method;
- import java.util.EventObject;
- import java.util.Vector;
- import test.framework.Test;
- import test.framework.TestResult;
-
- public class TestRunner extends Frame implements ActionListener, ItemListener, MouseListener, TextListener, WindowListener, Runnable {
- private Vector fExceptions;
- private Thread fRunner;
- private TestResult fTestResult;
- private Test fTestSuite;
- private TraceFrame fTraceFrame;
- private Label ivjerrorLabel;
- private Label ivjfailureLabel;
- private List ivjFailureList;
- private Label ivjLabel1;
- private Label ivjLabel3;
- private Label ivjLabel5;
- private Logo ivjLogo1;
- private Label ivjNumberOfErrors;
- private Label ivjNumberOfFailures;
- private Label ivjNumberOfRuns;
- private Panel ivjPanel1;
- private Panel ivjPanel2;
- private Button ivjQuitButton;
- private Button ivjrun;
- private Button ivjShowErrorButton;
- private TestStatus ivjStatusIndicator;
- private TextField ivjStatusLine;
- private TextField ivjSuiteField;
- private Label ivjsuiteLabel;
- private BorderLayout ivjTestRunnerBorderLayout;
- private Label ivjtotalLabel;
- // $FF: synthetic field
- static Class class$java$awt$Window;
-
- public TestRunner() {
- this.initialize();
- }
-
- public TestRunner(String title) {
- super(title);
- }
-
- private void about() {
- AboutDialog about = new AboutDialog(this);
- ((Dialog)about).setModal(true);
- ((Component)about).move(200, 200);
- ((Component)about).setVisible(true);
- }
-
- public void actionPerformed(ActionEvent e) {
- if (((EventObject)e).getSource() == this.getrun()) {
- this.conn1(e);
- }
-
- if (((EventObject)e).getSource() == this.getShowErrorButton()) {
- this.conn3(e);
- }
-
- if (((EventObject)e).getSource() == this.getSuiteField()) {
- this.conn6(e);
- }
-
- if (((EventObject)e).getSource() == this.getQuitButton()) {
- this.conn7(e);
- }
-
- }
-
- public void addError(TestResult result, Test test, Throwable t) {
- this.getNumberOfErrors().setText(Integer.toString(result.testErrors()));
- this.appendFailure("Error", test, t);
- }
-
- public void addFailure(TestResult result, Test test, Throwable t) {
- this.getNumberOfFailures().setText(Integer.toString(result.testFailures()));
- this.appendFailure("Failure", test, t);
- }
-
- private void appendFailure(String kind, Test test, Throwable t) {
- if (t.getMessage() != null) {
- this.getFailureList().add(kind + ": " + test + ":" + t.getMessage());
- } else {
- this.getFailureList().add(kind + ": " + test);
- }
-
- this.fExceptions.addElement(t);
- }
-
- private void clearStatus() {
- this.getStatusLine().setText("");
- }
-
- private void conn0(WindowEvent arg1) {
- try {
- ((Frame)this).dispose();
- System.exit(0);
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn1(ActionEvent arg1) {
- try {
- this.runSuite();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn14(ActionEvent arg1) {
- try {
- this.showErrorTrace();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn2(TextEvent arg1) {
- try {
- this.suiteNameChanged();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn3(ActionEvent arg1) {
- try {
- this.showErrorTrace();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn3(ItemEvent arg1) {
- try {
- this.listSelectionChanged();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn4(ItemEvent arg1) {
- try {
- this.listSelectionChanged();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn4(TextEvent arg1) {
- try {
- this.suiteNameChanged();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn5(MouseEvent arg1) {
- try {
- if (arg1.getClickCount() != 2) {
- return;
- }
-
- this.showErrorTrace();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn6(ActionEvent arg1) {
- try {
- this.runSuite();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn7(ActionEvent arg1) {
- try {
- this.quit();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- private void conn8(MouseEvent arg1) {
- try {
- this.about();
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- }
-
- public void endTest(TestResult result, Test test) {
- this.setLabelValue(this.getNumberOfRuns(), result.runTests());
- this.getStatusIndicator().step(result.wasSuccessful());
- }
-
- private Label geterrorLabel() {
- if (this.ivjerrorLabel == null) {
- try {
- this.ivjerrorLabel = new Label();
- this.ivjerrorLabel.setName("errorLabel");
- this.ivjerrorLabel.setText("Errors:");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjerrorLabel;
- }
-
- private Label getfailureLabel() {
- if (this.ivjfailureLabel == null) {
- try {
- this.ivjfailureLabel = new Label();
- this.ivjfailureLabel.setName("failureLabel");
- this.ivjfailureLabel.setText("Failures:");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjfailureLabel;
- }
-
- private List getFailureList() {
- if (this.ivjFailureList == null) {
- try {
- this.ivjFailureList = new List(6);
- this.ivjFailureList.setName("FailureList");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjFailureList;
- }
-
- private Label getLabel1() {
- if (this.ivjLabel1 == null) {
- try {
- this.ivjLabel1 = new Label();
- this.ivjLabel1.setName("Label1");
- this.ivjLabel1.setText("Progress:");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjLabel1;
- }
-
- private Label getLabel3() {
- if (this.ivjLabel3 == null) {
- try {
- this.ivjLabel3 = new Label();
- this.ivjLabel3.setName("Label3");
- this.ivjLabel3.setFont(new Font("dialog", 1, 12));
- this.ivjLabel3.setText(".suite( )");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjLabel3;
- }
-
- private Label getLabel5() {
- if (this.ivjLabel5 == null) {
- try {
- this.ivjLabel5 = new Label();
- this.ivjLabel5.setName("Label5");
- this.ivjLabel5.setText("Errors and Failures:");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjLabel5;
- }
-
- private Logo getLogo1() {
- if (this.ivjLogo1 == null) {
- try {
- this.ivjLogo1 = new Logo();
- this.ivjLogo1.setName("Logo1");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjLogo1;
- }
-
- private Label getNumberOfErrors() {
- if (this.ivjNumberOfErrors == null) {
- try {
- this.ivjNumberOfErrors = new Label();
- this.ivjNumberOfErrors.setName("NumberOfErrors");
- this.ivjNumberOfErrors.setFont(new Font("dialog", 1, 12));
- this.ivjNumberOfErrors.setAlignment(0);
- this.ivjNumberOfErrors.setText("10000");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjNumberOfErrors;
- }
-
- private Label getNumberOfFailures() {
- if (this.ivjNumberOfFailures == null) {
- try {
- this.ivjNumberOfFailures = new Label();
- this.ivjNumberOfFailures.setName("NumberOfFailures");
- this.ivjNumberOfFailures.setFont(new Font("dialog", 1, 12));
- this.ivjNumberOfFailures.setText("10000");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjNumberOfFailures;
- }
-
- private Label getNumberOfRuns() {
- if (this.ivjNumberOfRuns == null) {
- try {
- this.ivjNumberOfRuns = new Label();
- this.ivjNumberOfRuns.setName("NumberOfRuns");
- this.ivjNumberOfRuns.setFont(new Font("dialog", 1, 12));
- this.ivjNumberOfRuns.setText("10000");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjNumberOfRuns;
- }
-
- private Panel getPanel1() {
- GridBagConstraints constraintssuiteLabel = new GridBagConstraints();
- GridBagConstraints constraintsSuiteField = new GridBagConstraints();
- GridBagConstraints constraintsrun = new GridBagConstraints();
- GridBagConstraints constraintsLabel5 = new GridBagConstraints();
- GridBagConstraints constraintsFailureList = new GridBagConstraints();
- GridBagConstraints constraintsShowErrorButton = new GridBagConstraints();
- GridBagConstraints constraintsStatusLine = new GridBagConstraints();
- GridBagConstraints constraintsPanel2 = new GridBagConstraints();
- GridBagConstraints constraintsQuitButton = new GridBagConstraints();
- GridBagConstraints constraintsStatusIndicator = new GridBagConstraints();
- GridBagConstraints constraintsLogo1 = new GridBagConstraints();
- GridBagConstraints constraintsLabel1 = new GridBagConstraints();
- GridBagConstraints constraintsLabel3 = new GridBagConstraints();
- if (this.ivjPanel1 == null) {
- try {
- this.ivjPanel1 = new Panel();
- this.ivjPanel1.setName("Panel1");
- this.ivjPanel1.setLayout(new GridBagLayout());
- this.ivjPanel1.setBackground(SystemColor.control);
- constraintssuiteLabel.gridx = 1;
- constraintssuiteLabel.gridy = 0;
- constraintssuiteLabel.gridwidth = 2;
- constraintssuiteLabel.gridheight = 1;
- constraintssuiteLabel.fill = 2;
- constraintssuiteLabel.anchor = 17;
- constraintssuiteLabel.weightx = (double)0.0F;
- constraintssuiteLabel.weighty = (double)0.0F;
- constraintssuiteLabel.ipadx = 4;
- constraintssuiteLabel.ipady = 4;
- constraintssuiteLabel.insets = new Insets(0, 8, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getsuiteLabel(), constraintssuiteLabel);
- this.getPanel1().add(this.getsuiteLabel());
- constraintsSuiteField.gridx = 1;
- constraintsSuiteField.gridy = 2;
- constraintsSuiteField.gridwidth = 1;
- constraintsSuiteField.gridheight = 1;
- constraintsSuiteField.fill = 2;
- constraintsSuiteField.anchor = 10;
- constraintsSuiteField.weightx = (double)1.0F;
- constraintsSuiteField.weighty = (double)0.0F;
- constraintsSuiteField.insets = new Insets(0, 8, 0, 2);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getSuiteField(), constraintsSuiteField);
- this.getPanel1().add(this.getSuiteField());
- constraintsrun.gridx = 5;
- constraintsrun.gridy = 2;
- constraintsrun.gridwidth = 1;
- constraintsrun.gridheight = 1;
- constraintsrun.fill = 2;
- constraintsrun.anchor = 17;
- constraintsrun.weightx = (double)0.0F;
- constraintsrun.weighty = (double)0.0F;
- constraintsrun.insets = new Insets(0, 0, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getrun(), constraintsrun);
- this.getPanel1().add(this.getrun());
- constraintsLabel5.gridx = 1;
- constraintsLabel5.gridy = 10;
- constraintsLabel5.gridwidth = 2;
- constraintsLabel5.gridheight = 1;
- constraintsLabel5.fill = 2;
- constraintsLabel5.anchor = 10;
- constraintsLabel5.weightx = (double)0.0F;
- constraintsLabel5.weighty = (double)0.0F;
- constraintsLabel5.ipadx = 4;
- constraintsLabel5.ipady = 4;
- constraintsLabel5.insets = new Insets(0, 8, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLabel5(), constraintsLabel5);
- this.getPanel1().add(this.getLabel5());
- constraintsFailureList.gridx = 1;
- constraintsFailureList.gridy = 12;
- constraintsFailureList.gridwidth = 4;
- constraintsFailureList.gridheight = 2;
- constraintsFailureList.fill = 1;
- constraintsFailureList.anchor = 10;
- constraintsFailureList.weightx = (double)0.0F;
- constraintsFailureList.weighty = (double)1.0F;
- constraintsFailureList.insets = new Insets(0, 8, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getFailureList(), constraintsFailureList);
- this.getPanel1().add(this.getFailureList());
- constraintsShowErrorButton.gridx = 5;
- constraintsShowErrorButton.gridy = 13;
- constraintsShowErrorButton.gridwidth = 1;
- constraintsShowErrorButton.gridheight = 1;
- constraintsShowErrorButton.fill = 2;
- constraintsShowErrorButton.anchor = 10;
- constraintsShowErrorButton.weightx = (double)0.0F;
- constraintsShowErrorButton.weighty = (double)0.0F;
- constraintsShowErrorButton.insets = new Insets(0, 0, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getShowErrorButton(), constraintsShowErrorButton);
- this.getPanel1().add(this.getShowErrorButton());
- constraintsStatusLine.gridx = 0;
- constraintsStatusLine.gridy = 15;
- constraintsStatusLine.gridwidth = 5;
- constraintsStatusLine.gridheight = 1;
- constraintsStatusLine.fill = 2;
- constraintsStatusLine.anchor = 10;
- constraintsStatusLine.weightx = (double)1.0F;
- constraintsStatusLine.weighty = (double)0.0F;
- constraintsStatusLine.insets = new Insets(8, 8, 8, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getStatusLine(), constraintsStatusLine);
- this.getPanel1().add(this.getStatusLine());
- constraintsPanel2.gridx = 1;
- constraintsPanel2.gridy = 8;
- constraintsPanel2.gridwidth = 4;
- constraintsPanel2.gridheight = 1;
- constraintsPanel2.fill = 1;
- constraintsPanel2.anchor = 17;
- constraintsPanel2.weightx = (double)1.0F;
- constraintsPanel2.weighty = (double)0.0F;
- constraintsPanel2.insets = new Insets(0, 0, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getPanel2(), constraintsPanel2);
- this.getPanel1().add(this.getPanel2());
- constraintsQuitButton.gridx = 5;
- constraintsQuitButton.gridy = 15;
- constraintsQuitButton.gridwidth = 1;
- constraintsQuitButton.gridheight = 1;
- constraintsQuitButton.fill = 2;
- constraintsQuitButton.anchor = 10;
- constraintsQuitButton.weightx = (double)0.0F;
- constraintsQuitButton.weighty = (double)0.0F;
- constraintsQuitButton.insets = new Insets(0, 0, 0, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getQuitButton(), constraintsQuitButton);
- this.getPanel1().add(this.getQuitButton());
- constraintsStatusIndicator.gridx = 1;
- constraintsStatusIndicator.gridy = 5;
- constraintsStatusIndicator.gridwidth = 4;
- constraintsStatusIndicator.gridheight = 1;
- constraintsStatusIndicator.fill = 2;
- constraintsStatusIndicator.anchor = 10;
- constraintsStatusIndicator.weightx = (double)0.0F;
- constraintsStatusIndicator.weighty = (double)0.0F;
- constraintsStatusIndicator.insets = new Insets(0, 8, 8, 8);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getStatusIndicator(), constraintsStatusIndicator);
- this.getPanel1().add(this.getStatusIndicator());
- constraintsLogo1.gridx = 5;
- constraintsLogo1.gridy = 5;
- constraintsLogo1.gridwidth = 1;
- constraintsLogo1.gridheight = 4;
- constraintsLogo1.anchor = 11;
- constraintsLogo1.weightx = (double)0.0F;
- constraintsLogo1.weighty = (double)0.0F;
- constraintsLogo1.insets = new Insets(8, 4, 0, 0);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLogo1(), constraintsLogo1);
- this.getPanel1().add(this.getLogo1());
- constraintsLabel1.gridx = 1;
- constraintsLabel1.gridy = 3;
- constraintsLabel1.gridwidth = 2;
- constraintsLabel1.gridheight = 1;
- constraintsLabel1.anchor = 17;
- constraintsLabel1.weightx = (double)0.0F;
- constraintsLabel1.weighty = (double)0.0F;
- constraintsLabel1.insets = new Insets(4, 8, 0, 4);
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLabel1(), constraintsLabel1);
- this.getPanel1().add(this.getLabel1());
- constraintsLabel3.gridx = 2;
- constraintsLabel3.gridy = 2;
- constraintsLabel3.gridwidth = 1;
- constraintsLabel3.gridheight = 1;
- constraintsLabel3.anchor = 17;
- constraintsLabel3.weightx = (double)0.0F;
- constraintsLabel3.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLabel3(), constraintsLabel3);
- this.getPanel1().add(this.getLabel3());
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjPanel1;
- }
-
- private Panel getPanel2() {
- GridBagConstraints constraintstotalLabel = new GridBagConstraints();
- GridBagConstraints constraintsNumberOfRuns = new GridBagConstraints();
- GridBagConstraints constraintserrorLabel = new GridBagConstraints();
- GridBagConstraints constraintsNumberOfErrors = new GridBagConstraints();
- GridBagConstraints constraintsfailureLabel = new GridBagConstraints();
- GridBagConstraints constraintsNumberOfFailures = new GridBagConstraints();
- if (this.ivjPanel2 == null) {
- try {
- this.ivjPanel2 = new Panel();
- this.ivjPanel2.setName("Panel2");
- this.ivjPanel2.setLayout(new GridBagLayout());
- constraintstotalLabel.gridx = 0;
- constraintstotalLabel.gridy = 0;
- constraintstotalLabel.gridwidth = 1;
- constraintstotalLabel.gridheight = 1;
- constraintstotalLabel.anchor = 17;
- constraintstotalLabel.weightx = (double)0.0F;
- constraintstotalLabel.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.gettotalLabel(), constraintstotalLabel);
- this.getPanel2().add(this.gettotalLabel());
- constraintsNumberOfRuns.gridx = -1;
- constraintsNumberOfRuns.gridy = -1;
- constraintsNumberOfRuns.gridwidth = 1;
- constraintsNumberOfRuns.gridheight = 1;
- constraintsNumberOfRuns.anchor = 10;
- constraintsNumberOfRuns.weightx = (double)0.0F;
- constraintsNumberOfRuns.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getNumberOfRuns(), constraintsNumberOfRuns);
- this.getPanel2().add(this.getNumberOfRuns());
- constraintserrorLabel.gridx = -1;
- constraintserrorLabel.gridy = -1;
- constraintserrorLabel.gridwidth = 1;
- constraintserrorLabel.gridheight = 1;
- constraintserrorLabel.anchor = 10;
- constraintserrorLabel.weightx = (double)0.0F;
- constraintserrorLabel.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.geterrorLabel(), constraintserrorLabel);
- this.getPanel2().add(this.geterrorLabel());
- constraintsNumberOfErrors.gridx = -1;
- constraintsNumberOfErrors.gridy = -1;
- constraintsNumberOfErrors.gridwidth = 1;
- constraintsNumberOfErrors.gridheight = 1;
- constraintsNumberOfErrors.anchor = 10;
- constraintsNumberOfErrors.weightx = (double)0.0F;
- constraintsNumberOfErrors.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getNumberOfErrors(), constraintsNumberOfErrors);
- this.getPanel2().add(this.getNumberOfErrors());
- constraintsfailureLabel.gridx = -1;
- constraintsfailureLabel.gridy = -1;
- constraintsfailureLabel.gridwidth = 1;
- constraintsfailureLabel.gridheight = 1;
- constraintsfailureLabel.anchor = 10;
- constraintsfailureLabel.weightx = (double)0.0F;
- constraintsfailureLabel.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getfailureLabel(), constraintsfailureLabel);
- this.getPanel2().add(this.getfailureLabel());
- constraintsNumberOfFailures.gridx = -1;
- constraintsNumberOfFailures.gridy = -1;
- constraintsNumberOfFailures.gridwidth = 1;
- constraintsNumberOfFailures.gridheight = 1;
- constraintsNumberOfFailures.anchor = 10;
- constraintsNumberOfFailures.weightx = (double)0.0F;
- constraintsNumberOfFailures.weighty = (double)0.0F;
- ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getNumberOfFailures(), constraintsNumberOfFailures);
- this.getPanel2().add(this.getNumberOfFailures());
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjPanel2;
- }
-
- private Button getQuitButton() {
- if (this.ivjQuitButton == null) {
- try {
- this.ivjQuitButton = new Button();
- this.ivjQuitButton.setName("QuitButton");
- this.ivjQuitButton.setLabel("Quit");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjQuitButton;
- }
-
- private Button getrun() {
- if (this.ivjrun == null) {
- try {
- this.ivjrun = new Button();
- this.ivjrun.setName("run");
- this.ivjrun.setEnabled(false);
- this.ivjrun.setLabel("Run");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjrun;
- }
-
- private Button getShowErrorButton() {
- if (this.ivjShowErrorButton == null) {
- try {
- this.ivjShowErrorButton = new Button();
- this.ivjShowErrorButton.setName("ShowErrorButton");
- this.ivjShowErrorButton.setEnabled(false);
- this.ivjShowErrorButton.setActionCommand("Show...");
- this.ivjShowErrorButton.setLabel("Show...");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjShowErrorButton;
- }
-
- private TestStatus getStatusIndicator() {
- if (this.ivjStatusIndicator == null) {
- try {
- this.ivjStatusIndicator = new TestStatus();
- this.ivjStatusIndicator.setName("StatusIndicator");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjStatusIndicator;
- }
-
- private TextField getStatusLine() {
- if (this.ivjStatusLine == null) {
- try {
- this.ivjStatusLine = new TextField();
- this.ivjStatusLine.setName("StatusLine");
- this.ivjStatusLine.setFont(new Font("dialog", 1, 12));
- this.ivjStatusLine.setEditable(false);
- this.ivjStatusLine.setForeground(Color.red);
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjStatusLine;
- }
-
- private TextField getSuiteField() {
- if (this.ivjSuiteField == null) {
- try {
- this.ivjSuiteField = new TextField();
- this.ivjSuiteField.setName("SuiteField");
- this.ivjSuiteField.setFont(new Font("Dialog", 0, 12));
- this.ivjSuiteField.setColumns(40);
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjSuiteField;
- }
-
- private Label getsuiteLabel() {
- if (this.ivjsuiteLabel == null) {
- try {
- this.ivjsuiteLabel = new Label();
- this.ivjsuiteLabel.setName("suiteLabel");
- this.ivjsuiteLabel.setText("Enter the name of the TestCase class:");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjsuiteLabel;
- }
-
- private BorderLayout getTestRunnerBorderLayout() {
- BorderLayout ivjTestRunnerBorderLayout = null;
-
- try {
- ivjTestRunnerBorderLayout = new BorderLayout();
- ivjTestRunnerBorderLayout.setVgap(0);
- ivjTestRunnerBorderLayout.setHgap(0);
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
-
- return ivjTestRunnerBorderLayout;
- }
-
- private Label gettotalLabel() {
- if (this.ivjtotalLabel == null) {
- try {
- this.ivjtotalLabel = new Label();
- this.ivjtotalLabel.setName("totalLabel");
- this.ivjtotalLabel.setAlignment(0);
- this.ivjtotalLabel.setText("Runs:");
- } catch (Throwable ivjExc) {
- this.handleException(ivjExc);
- }
- }
-
- return this.ivjtotalLabel;
- }
-
- private void handleException(Throwable exception) {
- }
-
- private void initConnections() {
- ((Window)this).addWindowListener(this);
- this.getrun().addActionListener(this);
- this.getSuiteField().addTextListener(this);
- this.getShowErrorButton().addActionListener(this);
- this.getFailureList().addItemListener(this);
- this.getFailureList().addMouseListener(this);
- this.getSuiteField().addActionListener(this);
- this.getQuitButton().addActionListener(this);
- this.getLogo1().addMouseListener(this);
- }
-
- private void initialize() {
- ((Component)this).setName("TestRunner");
- ((Component)this).setName("TestRunner");
- ((Container)this).setLayout(this.getTestRunnerBorderLayout());
- ((Component)this).setSize(405, 309);
- ((Frame)this).setTitle("Run Test Suite");
- ((Container)this).add("Center", this.getPanel1());
- this.initConnections();
- this.resetCounters();
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (((EventObject)e).getSource() == this.getFailureList()) {
- this.conn4(e);
- }
-
- }
-
- private void listSelectionChanged() {
- this.getShowErrorButton().setEnabled(this.getFailureList().getSelectedIndex() != -1);
- }
-
- public static void main(String[] args) {
- try {
- TestRunner aTestRunner = new TestRunner();
-
- try {
- Class aCloserClass = Class.forName("uvm.abt.edit.WindowCloser");
- Class[] parmTypes = new Class[]{class$java$awt$Window != null ? class$java$awt$Window : (class$java$awt$Window = class$("java.awt.Window"))};
- Object[] parms = new Object[]{aTestRunner};
- Constructor aCtor = aCloserClass.getConstructor(parmTypes);
- aCtor.newInstance(parms);
- } catch (Throwable var6) {
- }
-
- ((Component)aTestRunner).move(200, 200);
- ((Component)aTestRunner).setVisible(true);
- if (args.length == 1) {
- aTestRunner.setSuiteName(args[0]);
- aTestRunner.runSuite();
- }
- } catch (Throwable var7) {
- System.err.println("Exception occurred in main() of java.awt.Frame");
- }
-
- }
-
- public void mouseClicked(MouseEvent e) {
- if (((EventObject)e).getSource() == this.getFailureList()) {
- this.conn5(e);
- }
-
- if (((EventObject)e).getSource() == this.getLogo1()) {
- this.conn8(e);
- }
-
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- private void quit() {
- System.exit(0);
- }
-
- private void reset() {
- this.resetCounters();
- this.clearStatus();
- this.getStatusIndicator().reset();
- this.resetFailureList();
- this.fExceptions = new Vector(10);
- }
-
- private void resetCounters() {
- this.setLabelValue(this.getNumberOfErrors(), 0);
- this.setLabelValue(this.getNumberOfFailures(), 0);
- this.setLabelValue(this.getNumberOfRuns(), 0);
- }
-
- private void resetFailureList() {
- this.getShowErrorButton().setEnabled(false);
- this.getFailureList().removeAll();
- }
-
- public void run() {
- this.getrun().setLabel("Stop");
- this.showInfo("Initializing...");
- this.reset();
- String vendor = System.getProperty("java.vendor");
- if (vendor == null || !vendor.equals("IBM")) {
- this.showInfo("Garbage Collection...");
- Runtime.getRuntime().gc();
- }
-
- this.showInfo("Load Test Case...");
- String suiteClassName = this.getSuiteField().getText();
- Class fixtureClass = null;
- Method suiteMethod = null;
- String methodName = "suite";
-
- try {
- fixtureClass = Class.forName(suiteClassName);
- } catch (Exception var15) {
- this.runFailed("Class \"" + suiteClassName + "\" not found");
- return;
- }
-
- try {
- suiteMethod = fixtureClass.getMethod(methodName);
- } catch (Exception var14) {
- this.runFailed("Class \"" + suiteClassName + "\" has no method named \"" + methodName + "\"");
- return;
- }
-
- try {
- this.fTestSuite = (Test)suiteMethod.invoke((Object)null);
- } catch (Exception var13) {
- this.runFailed("Could not invoke the suite() method");
- return;
- }
-
- this.fTestResult = new UITestResult(this);
- int totalRuns = this.fTestSuite.countTestCases();
- this.getStatusIndicator().start(totalRuns);
- this.showInfo("Running...");
- long startTime = System.currentTimeMillis();
- this.fTestSuite.run(this.fTestResult);
- if (this.fTestResult.shouldStop()) {
- this.showStatus("Stopped");
- } else {
- long endTime = System.currentTimeMillis();
- long runTime = endTime - startTime;
- this.showInfo("Finished: " + runTime / 1000L + "." + runTime % 1000L + " seconds");
- }
-
- this.fRunner = null;
- this.fTestSuite = null;
- this.fTestResult = null;
- this.getrun().setLabel("Run");
- }
-
- private void runFailed(String message) {
- this.showStatus(message);
- this.getrun().setLabel("Run");
- this.fRunner = null;
- }
-
- public void runSuite() {
- if (this.fRunner != null) {
- this.fTestResult.stop();
- } else {
- this.fRunner = new Thread(this);
- this.fRunner.start();
- }
- }
-
- private void setLabelValue(Label label, int value) {
- String text;
- if (value == 0) {
- text = " 0";
- } else {
- text = Integer.toString(value);
- }
-
- label.setText(text);
- }
-
- public void setSuiteName(String suite) {
- this.getSuiteField().setText(suite);
- }
-
- private void showErrorTrace() {
- int index = this.getFailureList().getSelectedIndex();
- if (index != -1) {
- Throwable t = (Throwable)this.fExceptions.elementAt(index);
- if (this.fTraceFrame == null) {
- this.fTraceFrame = new TraceFrame();
- this.fTraceFrame.move(100, 100);
- }
-
- this.fTraceFrame.showTrace(t);
- this.fTraceFrame.setVisible(true);
- }
- }
-
- private void showInfo(String message) {
- this.getStatusLine().setFont(new Font("dialog", 0, 12));
- this.getStatusLine().setForeground(Color.black);
- this.getStatusLine().setText(message);
- }
-
- private void showStatus(String status) {
- this.getStatusLine().setFont(new Font("dialog", 1, 12));
- this.getStatusLine().setForeground(Color.red);
- this.getStatusLine().setText(status);
- }
-
- private void suiteNameChanged() {
- this.getrun().setEnabled(this.getSuiteField().getText().length() != 0);
- this.clearStatus();
- }
-
- public void textValueChanged(TextEvent e) {
- if (((EventObject)e).getSource() == this.getSuiteField()) {
- this.conn2(e);
- }
-
- }
-
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowClosing(WindowEvent e) {
- if (((EventObject)e).getSource() == this) {
- this.conn0(e);
- }
-
- }
-
- public void windowDeactivated(WindowEvent e) {
- }
-
- public void windowDeiconified(WindowEvent e) {
- }
-
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowOpened(WindowEvent e) {
- }
-
- // $FF: synthetic method
- static Class class$(String class$) {
- try {
- return Class.forName(class$);
- } catch (ClassNotFoundException forName) {
- throw new NoClassDefFoundError(((Throwable)forName).getMessage());
- }
- }
- }
-